home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Graphics / Plotting / aa_Intel_Only / Gnuplot / GnuplotSource / DoubleObject.m < prev    next >
Encoding:
Text File  |  1995-06-12  |  1.1 KB  |  70 lines

  1. /*
  2.  *  Copyright (C) 1993  Robert Davis
  3.  *
  4.  *  This program is free software; you can redistribute it and/or
  5.  *  modify it under the terms of Version 2, or any later version, of 
  6.  *  the GNU General Public License as published by the Free Software 
  7.  *  Foundation.
  8.  */
  9.  
  10.  
  11. static char RCSId[]="$Id: DoubleObject.m,v 1.1 1993/05/04 16:21:43 davis Exp $";
  12.  
  13. #import <stdio.h>        /* sprintf() */
  14. #import "DoubleObject.h"
  15.  
  16. #define DIGITS_ACCURACY        10
  17.  
  18. @implementation DoubleObject
  19.  
  20.  
  21. /* Overrides SubObjects initFromString: */
  22. - initFromString:(const char *)aString
  23. {
  24.     return nil;
  25. }
  26.  
  27.  
  28. - initFromDouble:(double)aDouble
  29. {
  30.     [super init];
  31.     [self setDoubleValue:aDouble];
  32.  
  33.     return self;
  34. }
  35.  
  36.  
  37.  
  38. - setDoubleValue:(double)aDouble
  39. {
  40.     char string[1000];
  41.  
  42.     doubleValue = aDouble;
  43.     sprintf (string, "%.*f", DIGITS_ACCURACY, doubleValue);
  44.     [super setStringValue: string];
  45.     return self;
  46. }
  47.  
  48.  
  49. - (double)doubleValue
  50. {
  51.     return doubleValue;
  52. }
  53.  
  54.  
  55. - setStringValue:(const char *)aString
  56. {
  57.     return self;
  58. }
  59.  
  60.  
  61.  
  62. // Shuts up the compiler about unused RCSId
  63. - (const char *) rcsid
  64. {
  65.     return RCSId;
  66. }
  67.  
  68.  
  69. @end
  70.